<template>
  <div v-if="DialogInput" class="DialogInput">
    <el-dialog :title="dialogTitle" :visible.sync="DialogInput" width="400px" :close-on-click-modal="false" @close="dialogClose">
      <h2>请输入分类名称</h2>
      <el-input v-model="inputValue" placeholder="请输入内容" class="inputValueClass" />
      <div slot="footer" class="dialog-footer" align="right">
        <el-button size="medium" round @click="dialogClose">取 消</el-button>
        <el-button size="medium" round type="primary" @click="onSubmit()">保 存</el-button>
      </div>
    </el-dialog>
  </div>
</template>

<script>
export default {
  data() {
    return {
      inputValue: '',
      whichClick: '',
      DialogInput: false,
      dialogTitle: '新增分类'
    }
  },
  computed: {
    // ...mapGetters(["userInfo"])
  },
  watch: {
    // userInfo(newValue, oldValue) {
    //   console.log(newValue)
    // }
  },
  created() {

  },
  mounted() {

  },
  destroyed() {

  },
  methods: {
    /* 数据请求*/
    /* 按钮点击*/
    onSubmit() {
      this.DialogInput = false
      this.$emit('emitDialogSave', this.inputValue, this.whichClick, this.rowItem)
    },
    /* other*/
    dialogShow(parentData) {
      this.DialogInput = true
      this.dialogTitle = parentData.dialogTitle
      this.whichClick = parentData.whichClick
      if (parentData.rowItem) { // 编辑特有
        this.rowItem = parentData.rowItem
      }
    },
    dialogClose() {
      this.DialogInput = false
    }
  }
}
</script>

<style scoped lang="scss">
  .DialogInput {

  }
  .inputValueClass{
    margin-top: 15px;
  }
  .dialog-footer{
    margin-top: 60px;
  }
</style>
